Video graphics display systems commonly utilize primitives, often in the form of triangle primitives, to model objects to be drawn to a displayed image. Modeling the object to be drawn using primitives often requires a number of primitives in order to accurately represent three-dimensional objects. Each of these primitives includes a number of parameters corresponding to each of the vertices of the primitive. The parameters include color and alpha blending values, as well as spatial coordinates and normal vectors that may be used for calculating lighting effects that aid in accurately representing the object in the displayed image.
In prior art systems, the color and alpha blending values at each vertex of the video graphics primitive are calculated and then interpolated across the primitive in order to determine the specific color and alpha values for each pixel included in the primitive. Determination of the color values at the vertices of the primitive could include calculating lighting effects based on one or more lighting sources that may affect the color at the vertices. An equation commonly used for determination of vertex color values such that lighting effects are included is:
                    Vertex_color        =                ⁢                  emissive_color          +                      (                          ambient_light              ⁢                                                          ⨯                                                                                  ⁢                      ambient            ⁢                                                  ⁢            material_color                    )                +                                            ∑                              i                =                0                                      M                    ⁢                                          ⁢                                    (              range              )                        ⨯                          (                              spot_atten                .                            )                        ⨯                                                          ⁢                  [                                    (                                                ambient_light                  ⁢                                                                          ⨯                  ambient_material                                ⁢                _color                            )                        +                                                          ⁢                                            (                                                n                  →                                ⁢                                                                  ⁢                •                ⁢                                                                  ⁢                                  L                  →                                            )                        ⁢                          (                                                diffuse_light                  ⁢                                                                          ⨯                                                                          ⁢                  diffuse_material                                ⁢                _color                            )                                +                                                ⁢                              (                                          s                →                            ⁢                                                          ⁢              •              ⁢                                                          ⁢                              n                →                                      )                    ⁢                      (                                          specular_light                ⁢                                                                  ⨯                specular_material                            ⁢              _color                        )                          ]            
wherein the summation portion has a component corresponding to each light source that is relevant.
As the equation illustrates, the vertex color values are a function of a number of different factors. Such factors are well known in the art, and the calculations required to determine the vertex colors are also well known. As the equation indicates, some of the factors are dependant on the normal vector ({overscore (n)}) that corresponds to the particular vertex. Such normal vectors represent a vector that is normal to the surface of the object at the point where the vertex is located.
Problems can arise when large video graphics primitives are drawn that include lighting effects that are dependent on the normal values at the vertices. This is because prior art video graphics systems commonly interpolate the vertex color and alpha values across the entire primitive in order to determine the specific color and alpha values for each pixel within the primitive. Because the lighting effects are only calculated at the vertices, the shading produced by such lighting effects will be linearly spread across such large primitives, often reducing the realism with which the object is rendered. Such prior art interpolation of vertex color and alpha values to determine specific pixel color and alpha values is commonly referred to as Gouraud shading.
In order to avoid some of the detrimental effects on the shading of the primitive due to interpolation, another prior art technique for calculating lighting effects commonly known as Phong shading is used. Phong shading recalculates a normal value for each pixel location prior to determining the specific color and alpha values for that specific location. Although Phong shading produces better results than Gouraud shading, the processing bandwidth required to implement full-scale Phong shading is relatively large, and therefore Phong shading is impractical in most video graphics systems as it is too expensive to implement.
Therefore, a need exists for a method and apparatus for performing lighting operations with respect to primitives that improves on the coarse granularity of Gouraud shading while reducing the processing bandwidth requirements in comparison with those corresponding to Phong shading.